package Module::Changes::Validator::YAML;

use warnings;
use strict;
use Kwalify ();
use YAML;;


our $VERSION = '0.06';


use base 'Module::Changes::Base';


my $schema = Load(<<EOSCHEMA);
type: map
mapping:
    global:
        type: map
        mapping:
            name:
                type: str
                required: yes
    releases:
        type: seq
        sequence:
            - type: map
              mapping:
                  version:
                      type: scalar
                      required: yes
                  author:
                      type: str
                      required: yes
                  changes:
                      type: seq
                      sequence:
                        - type: str
                  date:
                      type: str
                      required: yes
                  tags:
                      type: seq
                      sequence:
                        - type: str
EOSCHEMA


sub validate {
    my ($self, $yaml) = @_;
    Kwalify::validate($schema, $yaml);
}


1;

__END__

{% USE p = PodGenerated %}

=head1 NAME

Module::Changes::Validator::YAML - validate a YAML Changes string

=head1 SYNOPSIS

    use Module::Changes;
    my $validator = Module::Changes->make_object_for_type('validator_yaml');
    $validatew->validate($yaml);

=head1 DESCRIPTION

This class can validate YAML strings. The required layout of the YAML file is
documented in L<Module::Changes>.

=head1 METHODS

=over 4

{% p.write_methods %}

=item validate

    print $validator->validate($yaml);

Takes a YAML string and validates it, returning a boolean value.

=back

{% p.write_inheritance %}

{% PROCESS standard_pod %}

=cut

